﻿using System.Web;

using NetFramework.Web.Ajax;

namespace NetFramework.Ajax
{
    public abstract class AjaxPageBase : System.Web.UI.Page
    {
        protected virtual AjaxResponseType ResponseType
        {
            get
            {
                return AjaxResponseType.Json;
            }
        }

        protected override void OnInit(System.EventArgs e)
        {
            string methodToCall = Request.Params["Method"];
            if (string.IsNullOrEmpty(methodToCall))
            {
                base.OnInit(e);
            }
            else
            {
                ICallbackMethodProcessor processor = new JsonCallbackMethodProcessor();
                processor.ProcessCallbackMethodCall(this);
            }
        }
    }
}
